package com.ruoyi.project.gzbook.cardsale.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.gzbook.cardsale.mapper.DgCardSaleMapper;
import com.ruoyi.project.gzbook.cardsale.domain.DgCardSale;
import com.ruoyi.project.gzbook.cardsale.service.IDgCardSaleService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 卡券Service业务层处理
 * 
 * @author mhg
 * @date 2021-10-08
 */
@Service
public class DgCardSaleServiceImpl implements IDgCardSaleService 
{
    @Autowired
    private DgCardSaleMapper dgCardSaleMapper;

    /**
     * 查询卡券
     * 
     * @param id 卡券主键
     * @return 卡券
     */
    @Override
    public DgCardSale selectDgCardSaleById(Long id)
    {
        return dgCardSaleMapper.selectDgCardSaleById(id);
    }

    /**
     * 查询卡券列表
     * 
     * @param dgCardSale 卡券
     * @return 卡券
     */
    @Override
    public List<DgCardSale> selectDgCardSaleList(DgCardSale dgCardSale)
    {
        return dgCardSaleMapper.selectDgCardSaleList(dgCardSale);
    }

    /**
     * 新增卡券
     * 
     * @param dgCardSale 卡券
     * @return 结果
     */
    @Override
    public int insertDgCardSale(DgCardSale dgCardSale)
    {
        dgCardSale.setCreateTime(DateUtils.getNowDate());
        return dgCardSaleMapper.insertDgCardSale(dgCardSale);
    }

    /**
     * 修改卡券
     * 
     * @param dgCardSale 卡券
     * @return 结果
     */
    @Override
    public int updateDgCardSale(DgCardSale dgCardSale)
    {
        return dgCardSaleMapper.updateDgCardSale(dgCardSale);
    }

    /**
     * 批量删除卡券
     * 
     * @param ids 需要删除的卡券主键
     * @return 结果
     */
    @Override
    public int deleteDgCardSaleByIds(String ids)
    {
        return dgCardSaleMapper.deleteDgCardSaleByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除卡券信息
     * 
     * @param id 卡券主键
     * @return 结果
     */
    @Override
    public int deleteDgCardSaleById(Long id)
    {
        return dgCardSaleMapper.deleteDgCardSaleById(id);
    }
}
